package com.ruoyi.production.service.impl.pesticide;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.production.mapper.pesticide.PesticideTypeMapper;
import com.ruoyi.production.domain.pesticide.PesticideType;
import com.ruoyi.production.service.pesticide.IPesticideTypeService;

/**
 * 农药类型Service业务层处理
 *
 * @author ruoyi
 * @date 2021-07-12
 */
@Service
public class PesticideTypeServiceImpl implements IPesticideTypeService
{
    @Autowired
    private PesticideTypeMapper pesticideTypeMapper;

    /**
     * 查询农药类型
     *
     * @param pesticideTypeId 农药类型ID
     * @return 农药类型
     */
    @Override
    public PesticideType selectPesticideTypeById(Long pesticideTypeId)
    {
        return pesticideTypeMapper.selectPesticideTypeById(pesticideTypeId);
    }

    /**
     * 查询农药类型列表
     *
     * @param pesticideType 农药类型
     * @return 农药类型
     */
    @Override
    public List<PesticideType> selectPesticideTypeList(PesticideType pesticideType)
    {
        return pesticideTypeMapper.selectPesticideTypeList(pesticideType);
    }

    /**
     * 新增农药类型
     *
     * @param pesticideType 农药类型
     * @return 结果
     */
    @Override
    public int insertPesticideType(PesticideType pesticideType)
    {
        pesticideType.setCreateTime(DateUtils.getNowDate());
        return pesticideTypeMapper.insertPesticideType(pesticideType);
    }

    /**
     * 修改农药类型
     *
     * @param pesticideType 农药类型
     * @return 结果
     */
    @Override
    public int updatePesticideType(PesticideType pesticideType)
    {
        pesticideType.setUpdateTime(DateUtils.getNowDate());
        return pesticideTypeMapper.updatePesticideType(pesticideType);
    }

    /**
     * 批量删除农药类型
     *
     * @param pesticideTypeIds 需要删除的农药类型ID
     * @return 结果
     */
    @Override
    public int deletePesticideTypeByIds(Long[] pesticideTypeIds)
    {
        return pesticideTypeMapper.deletePesticideTypeByIds(pesticideTypeIds);
    }

    /**
     * 删除农药类型信息
     *
     * @param pesticideTypeId 农药类型ID
     * @return 结果
     */
    @Override
    public int deletePesticideTypeById(Long pesticideTypeId)
    {
        return pesticideTypeMapper.deletePesticideTypeById(pesticideTypeId);
    }
}
